#include <iostream>
    
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <chrono>
   
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
   
using namespace std;
typedef long long ll;

const int maxn = 1e5 + 10;

int n, a[maxn], b[maxn];
int p1, q1, p2, q2;
 
inline int pre(int i){ return i - 1 == -1? n - 1: i - 1;}
inline int nxt(int i){return i + 1 == n? 0: i + 1;}
 
int vis[maxn], ans[maxn];
int pos1[maxn], pos2[maxn];
 
int main(){
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        scanf("%d", a + i);
        pos1[a[i]] = i;
    }
    for(int i = 0; i < n; i++){
        scanf("%d", b + i);
        pos2[b[i]] = i;
    }

    for(int key = 1; key <= n; key++) if(!vis[key]){
        p1 = nxt(pos1[key]); q1 = pre(pos1[key]);
        p2 = nxt(pos2[key]); q2 = pre(pos2[key]);
         
        int fail = 0;
        ans[0] = key; vis[key] = 1;
        for(int i = 1; i < n; i++){
            if(a[p1] == b[p2]){
                ans[i] = a[p1];
                p1 = nxt(p1); p2 = nxt(p2);
            }
            else if(a[p1] == b[q2]){
                ans[i] = a[p1];
                p1 = nxt(p1); q2 = pre(q2);
            }
            else if(a[q1] == b[p2]){
                ans[i] = a[q1];
                q1 = pre(q1); p2 = nxt(p2);
            }
            else if(a[q1] == b[q2]){
                ans[i] = a[q1];
                q1 = pre(q1); q2 = pre(q2);
            }
            else{
                fail = 1; break;
            }
            vis[ans[i]] = 1;
        }
        if(!fail){
            for(int i = 0; i < n; i++) printf("%d ", ans[i]);
            printf("\n");
            return 0;
        }
    }
    puts("-1");
    return 0;
}
 
